//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class TransformEffect : Effect
    {
        private double sx;

        private double sy;

        public double Sx
        {
            get { return sx; }
            set { sx = value; }
        }

        public double Sy
        {
            get { return sy; }
            set { sy = value; }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("xfrm"))
            {
                Sx = SerializationHelper.GetOptionalPercent(c, "sx", 100000);
                Sy = SerializationHelper.GetOptionalPercent(c, "sy", 100000);
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("xfrm"))
            {
                SerializationHelper.SetOptionalPercent(c, "sx", Sx, 100000);
                SerializationHelper.SetOptionalPercent(c, "sy", Sy, 100000);
            }
        }
    }
}